/*
 * @(#)MaintCalendarRecurForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.calendar.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.calendar.bean.CalendarRecur;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;

/**
  MaintCalendarRecurForm.java

  This class is the for web form purpose.

  @author      Tony Chen
  @company     DCIVision Limited
  @creation date   01/12/2003
  @version     $Revision: 1.4 $
*/

public class MaintCalendarRecurForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.4 $";

  private String calendarID = null;
  private String startDate = null;
  private String endDate = null;
  private String repeatTimes = null;
  private String recurType = null;
  private String repeatOn = null;
  private String repeatType = null;
  private String repeatTypeDay = null;
  private String occurType = null;
  private String occurWeekDay = null;
  private String occurMonth = null;

  public MaintCalendarRecurForm() {
    super();
  }

  public String getCalendarID() { 
    return(this.calendarID);
  }

  public void setCalendarID(String calendarID) { 
    this.calendarID = calendarID;
  }

  public String getStartDate() { 
    return(this.startDate);
  }

  public void setStartDate(String startDate) { 
    this.startDate = startDate;
  }

  public String getEndDate() { 
    return(this.endDate);
  }

  public void setEndDate(String endDate) { 
    this.endDate = endDate;
  }

  public String getRepeatTimes() { 
    return(this.repeatTimes);
  }

  public void setRepeatTimes(String repeatTimes) { 
    this.repeatTimes = repeatTimes;
  }

  public String getRecurType() { 
    return(this.recurType);
  }

  public void setRecurType(String recurType) { 
    this.recurType = recurType;
  }

  public String getRepeatOn() { 
    return(this.repeatOn);
  }

  public void setRepeatOn(String repeatOn) { 
    this.repeatOn = repeatOn;
  }

  public String getRepeatType() { 
    return(this.repeatType);
  }

  public void setRepeatType(String repeatType) { 
    this.repeatType = repeatType;
  }

  public String getRepeatTypeDay() { 
    return(this.repeatTypeDay);
  }

  public void setRepeatTypeDay(String repeatTypeDay) { 
    this.repeatTypeDay = repeatTypeDay;
  }

  public String getOccurType() { 
    return(this.occurType);
  }

  public void setOccurType(String occurType) { 
    this.occurType = occurType;
  }

  public String getOccurWeekDay() { 
    return(this.occurWeekDay);
  }

  public void setOccurWeekDay(String occurWeekDay) { 
    this.occurWeekDay = occurWeekDay;
  }

  public String getOccurMonth() { 
    return(this.occurMonth);
  }

  public void setOccurMonth(String occurMonth) { 
    this.occurMonth = occurMonth;
  }
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setCalendarID(null);
    this.setStartDate(null);
    this.setEndDate(null);
    this.setRepeatTimes(null);
    this.setRecurType(null);
    this.setRepeatOn(null);
    this.setRepeatType(null);
    this.setRepeatTypeDay(null);
    this.setOccurType(null);
    this.setOccurWeekDay(null);
    this.setOccurMonth(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    CalendarRecur tmpCalendarRecur = new CalendarRecur();
    tmpCalendarRecur.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpCalendarRecur.setCalendarID(TextUtility.parseIntegerObj(this.getCalendarID()));
    tmpCalendarRecur.setStartDate(parseTimestamp(this.getStartDate()));
    tmpCalendarRecur.setEndDate(parseTimestamp(this.getEndDate()));
    tmpCalendarRecur.setRepeatTimes(TextUtility.parseIntegerObj(this.getRepeatTimes()));
    tmpCalendarRecur.setRecurType(this.getRecurType());
    tmpCalendarRecur.setRepeatOn(TextUtility.parseIntegerObj(this.getRepeatOn()));
    tmpCalendarRecur.setRepeatType(this.getRepeatType());
    tmpCalendarRecur.setRepeatTypeDay(this.getRepeatTypeDay());
    tmpCalendarRecur.setOccurType(TextUtility.parseIntegerObj(this.getOccurType()));
    tmpCalendarRecur.setOccurWeekDay(TextUtility.parseIntegerObj(this.getOccurWeekDay()));
    tmpCalendarRecur.setOccurMonth(TextUtility.parseIntegerObj(this.getOccurMonth()));
    tmpCalendarRecur.setRecordStatus(this.getRecordStatus());
    tmpCalendarRecur.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpCalendarRecur.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpCalendarRecur.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpCalendarRecur.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpCalendarRecur.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpCalendarRecur;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    CalendarRecur tmpCalendarRecur = (CalendarRecur)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpCalendarRecur.getID()));
    this.setCalendarID(TextUtility.formatIntegerObj(tmpCalendarRecur.getCalendarID()));
    this.setStartDate(formatTimestamp(tmpCalendarRecur.getStartDate()));
    this.setEndDate(formatTimestamp(tmpCalendarRecur.getEndDate()));
    this.setRepeatTimes(TextUtility.formatIntegerObj(tmpCalendarRecur.getRepeatTimes()));
    this.setRecurType(tmpCalendarRecur.getRecurType());
    this.setRepeatOn(TextUtility.formatIntegerObj(tmpCalendarRecur.getRepeatOn()));
    this.setRepeatType(tmpCalendarRecur.getRepeatType());
    this.setRepeatTypeDay(tmpCalendarRecur.getRepeatTypeDay());
    this.setOccurType(TextUtility.formatIntegerObj(tmpCalendarRecur.getOccurType()));
    this.setOccurWeekDay(TextUtility.formatIntegerObj(tmpCalendarRecur.getOccurWeekDay()));
    this.setOccurMonth(TextUtility.formatIntegerObj(tmpCalendarRecur.getOccurMonth()));
    this.setRecordStatus(tmpCalendarRecur.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpCalendarRecur.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpCalendarRecur.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpCalendarRecur.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpCalendarRecur.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpCalendarRecur.getUpdateDate()));
  }
}
